<?php
require ('../include/init.inc.php');
$tourist_id = $tourist_name = $tourist_type =$tourist_addr=$tourist_pay=$self_drive=$tourist_start_time =$tourist_end_time=$is_pay='';
extract ( $_POST, EXTR_IF_EXISTS );

if (Common::isPost ()) {
  if($tourist_id=="" || $tourist_name=="" || $tourist_type ==""|| $tourist_addr=="" || $tourist_pay =="" || $self_drive ==""|| $tourist_start_time=="" || $tourist_end_time ==""){
		
		OSAdmin::alert("error",ErrorMessage::NEED_PARAM);
	}else{
		$input_data = array ('tourist_id' => $tourist_id, 'tourist_name' => $tourist_name ,
				'tourist_type' => $tourist_type, 'tourist_addr' => $tourist_addr , 'tourist_pay' => $tourist_pay ,
				'self_drive' => $self_drive, 'tr_create_time' => time() , 'tourist_start_time' => strtotime($tourist_start_time) ,
				 'tourist_end_time' =>strtotime($tourist_end_time), 'is_pay' => $is_pay );

		$tr_id = TouristOrder::addTouristOrder($input_data);
		
		if ($tr_id>0) {
			SysLog::addLog ( UserSession::getUserName(), 'ADD', 'tourist_order' ,$tr_id, json_encode($input_data) );
			Common::exitWithSuccess ('账号添加旅游订单','panel/tourist_orders.php');
		}else{
			OSAdmin::alert("error");
		}
	}
}
Template::assign ( 'tourist_conf', $baseConf["touristOrder"] );
Template::assign("_POST" ,$_POST);
Template::display ( 'panel/tourist_order_add.tpl' );
